package com.yyx.app1.Question_function.Control.petinfo;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yyx.app1.Data.BaseDataManager;
import com.yyx.app1.Data.testDate;
import com.yyx.app1.MyApp;
import com.yyx.app1.R;
import com.yyx.app1.tool.ImageTool;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

/**
 * Created by Administrator on 2015/10/21.
 */
@EViewGroup(R.layout.item_petbaseinfo)
public class Item_PetBaseInfo extends LinearLayout{
    private Context context;

    @ViewById
    TextView item_nicheng,item_time,item_sex,item_type;

    @ViewById
    ImageView itemview_portrait,username_ico,time_ico,sec_ico,type_ico;


    public Item_PetBaseInfo(Context context) {
        super(context);
        this.context = context;
    }

    public Item_PetBaseInfo(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    public Item_PetBaseInfo(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
    }

    @AfterViews
    public void init()
    {
        int[] res = new int[]{R.drawable.button2,R.drawable.button3,R.drawable.button1,R.drawable.button9};
        ImageView[] imageViews = new ImageView[]{username_ico,time_ico,sec_ico,type_ico};
        for (int i = 0 ; i< 4 ; ++i) {
            imageViews[i].setImageBitmap(BaseDataManager.getMyBaseDataManager(context).getResDrawable(res[i], ImageTool.dip2px(context, 18), ImageTool.dip2px(context, 18)));
            imageViews[i].setBackgroundResource(testDate.yuanjiao[i%testDate.yuanjiao.length]);
        }
    }


    public void bind()
    {
        item_nicheng.setText("布宜诺斯艾利斯");
        item_time.setText("2015/10/15");
        item_sex.setText("公");
        item_type.setText("泰迪");
    }
}
